package com.woniuxy;

import com.woniuxy.entity.CommentReplay;
import com.woniuxy.entity.RbacManager;
import com.woniuxy.entity.dto.RbacManagerDto;
import org.junit.jupiter.api.Test;
import org.modelmapper.ModelMapper;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @Author: linKe
 * @Date: 2021/12/3 0:22
 * @FileName: RbacManagerUtil转换
 * @version: 1.0
 * @Description: DTO转换工具类
 */
@SpringBootTest
public class RbacManagerDtoUtil {


    private final ModelMapper modelMapper = new ModelMapper() ;
    @Test
    void managerDto(){
        RbacManager rbacManager = new RbacManager();
        rbacManager.setId(2);
        rbacManager.setAccount("3");
        rbacManager.setPassword("2");
        rbacManager.setStatus("y");
        rbacManager.setRoleId(3);
        rbacManager.setRoles("3");

        //Dto类型转换
        RbacManagerDto rbacManagerDto = this.modelMapper.map(rbacManager, RbacManagerDto.class);
        //RbacManagerDto(id=2, account=3, password=2, status=y, roleId=3, roles=3)
        System.out.println(rbacManagerDto);

    }
    @Test
    void commentReplay(){
        //BaseEntity baseEntity = new BaseEntity();
        //baseEntity.setId("23");

        CommentReplay commentReplay = new CommentReplay();
        commentReplay.setId("3");
        String id = commentReplay.getId();
        System.out.println(commentReplay.getId());
        System.out.println(commentReplay);
    }


}
